{% extends "base.html" %}

{% block stylesheets %}
  <link rel="stylesheet" type="text/css" href="/assets/css/pagination.css">
  <link rel="stylesheet" type="text/css" href="/assets/css/captures.css">
{% endblock %}

{% block body %}
  <nav aria-label="page" id="pagination" class="mb-0">
    {% include('Captures/pagination.html') %}
  </nav>

  <div class="page-count-summary mb-0 mx-2 my-1">
    {{ "#{lang['page']} #{cur_page} #{lang['of']} #{page_count}" }}
  </div>

  {% set col_count = 0 %}
  {% set i = 0 %}
  {% set img_count = capture.list|length %}

  {% for capture in capture.list %}
    {% if col_count % 3 == 0 %}
      <div class="card-group capture-image-cards">
    {% endif %}

        <div class="card bg-light m-2 p-2 image-card">
          <a href="/captures/listImages?pass_id={{ capture.id }}">
            {% if capture.sat_type == 0 %}
              <img class="card-img-top" src="{{ constant('Config\\Config::THUMB_PATH') }}/{{ capture.file_path }}-122-rectified.jpg">
            {% elseif capture.sat_type == 1 %}
              {% if capture.daylight_pass == 1 %}
                <img class="card-img-top" src="{{ constant('Config\\Config::THUMB_PATH') }}/{{ capture.file_path }}-MSA.jpg">
              {% else %}
                <img class="card-img-top" src="{{ constant('Config\\Config::THUMB_PATH') }}/{{ capture.file_path }}-MCIR.jpg">
              {% endif %}
            {% elseif capture.sat_type == 2 %}
              <img class="card-img-top" src="{{ constant('Config\\Config::THUMB_PATH') }}/{{ capture.file_path }}-0.jpg">
            {% endif %}
          </a>
          <div class="card-body my-0 py-0 pt-3">
            <h5 class="card-title">{{ capture.sat_name }}</h5>
            <p>
              <strong>{{ lang.elev }}: </strong>{{ capture.max_elev }}&#176;&nbsp;
              {% if capture.azimuth_at_max != "" %}
                {% if capture.azimuth_at_max >= 0 and capture.azimuth_at_max <= 180 %}E{% else %}W{% endif %}
              {% endif %}

              <br>
              {% if capture.pass_start_azimuth != '' %}
                <strong>{{ lang.pass_start_azimuth }}: </strong>{{ capture.pass_start_azimuth }}&#176;<br>
              {% endif %}
              {% if capture.direction != '' %}
                <strong>{{ lang.travel_direction }}: </strong>{{ capture.direction }}<br>
              {% endif %}
              <strong>{{ lang.pass_start }}: </strong>{{ capture.pass_start|date(constant('Config\\Config::DATETIME_FORMAT')) }}<br>
              <strong>{{ lang.gain }}: </strong>
                {% if capture.gain == '0' %}
                  Auto
                {% elseif capture.gain == '' %}
                  Unknown
                {% else %}
                  {{ capture.gain }}
                {% endif %}
            </p>
          </div>
        </div>

    {% set i = i + 1 %}
    {% set col_count = col_count + 1 %}

    {% if (col_count % 3 == 0) or (i >= img_count) %}
      </div>
    {% endif %}
  {% endfor %}

  <nav aria-label="page" id="pagination" class="d-md-none mb-0">
    {% include('Captures/pagination.html') %}
  </nav>

{% endblock %}
